//用户选择
function selectSH(id) {
	var te = $("#SH").attr("btnType");
	if(te == "隐藏") {
		$("#SH").attr("btnType", "显示");
		$("#selectBox").fadeIn(600, function() {
			$("#selectBox").css("display", "block")
		})
	}
	if(te == "显示") {
		$("#SH").attr("btnType", "隐藏");
		$("#selectBox").fadeOut(600, function() {
			$("#selectBox").css("display", "none")
		})
	}
}
//用户选择结束

//设置session参数
function setSessionfunc(typeid,zid,tankuang,danwei){
	
	//设置当前用户的session值
    //typeid 系统分类id (比如对应前端八大类), zid 当前用户的站点id
	var url="/bigscrenn/setUserSession?typeid="+typeid+"&zid="+zid+"&cid="+tankuang;
    $.ajax({
	     cache: true,
	     type: "POST",
	     url:url,
	     data:"",
	     async: false,				   
	     success: function(data){
              console.log(data,'参数');         
	     }
    		
    });	
};
var userid = "";   //用户id
var unitID = "";   //单位id
var userType = ""; //用户类型
var kehu = [];     //左边列表
var zhandian = []; //站点数组
var zid = "";     //站点id
var zName='';      //站点名称
var danweiID='';    //单位id
var danweiName='';   //单位名称
//获取session 开始
getSession();
function getSession(){
	
	var url="/bigscrenn/getUserSession";
     $.ajax({
	     cache: true,
	     type: "POST",
	     url:url,
	     data:"",
	     async: false,				   
	     success: function(data){
	    	 //alert("session数据：="+data);
	    	 //js解析json串
     	     var obj = JSON.parse(data);
             if (obj.session.length>0){
                   /*alert(obj.session[0].UserID);//用户id
                   alert(obj.session[0].Name);//用户名称
                   alert(obj.session[0].UnitID);//用户单位id
                   alert(obj.session[0].UserAuthority);//用户权限 2 所有单位 3 本单位
                   alert(obj.session[0].typeid);//系统分类id (比如对应前端八大类)
                   alert(obj.session[0].zid);//当前用户的站点id*/			            	   
            	   userid = obj.session[0].UserID;
 	  			   unitID = obj.session[0].UnitID;
 	  			   userType = obj.session[0].UserAuthority;
 	  			   //zid = obj.session[0].zid;
 	  			   
 	  			   danweiID = (obj.session[0].cid1).split(",")[0];  //单位id方法
 	  			   danweiName = (obj.session[0].cid1).split(",")[1];//上页选中来的单位名称
 	  			   
 	  			   //vs.zid = obj.session[0].zid;
 	  			   zid = (obj.session[0].zid).split(",")[0];  //站点id
 	  			   zName = (obj.session[0].zid).split(",")[1];//上页选中来的站点名称
 	  			   //alert("历史曲线 danweiID="+danweiID + " danweiName= "+danweiName +"zid = "+zid +"zName = "+zName);
 	  			   $('#topTitle').text(zName);
 	  			   
 	  			   zhandianid = zid;
 	  			   onlineFunc();
 	  			   
 	  			   console.log("站点id="+zid);
 	  			   //setSessionfunc('',vs.zid+','+vs.zName,'',(vs.danweiID+','+vs.danweiName));     // session存站点（第二个参）
 	  			   
 	  			   
 	  			   if(zid==undefined){
 	  				zid = obj.session[0].zid;
 	  			   }
 	  			   //vs.getData(userid,zid);
             }
                 //alert("zid= "+zid+"userid="+userid+"and unitID="+unitID+"and userType="+userType) ;
                 //alert("zid = "+zid);
                
                if(zid && zid != '' && zid != null && zid!= undefined){
                	//vs.getUnitIData(userid,unitID);
                }
                //具体用户进来的操作
                if(userType==3){
                	console.log("我的身份是具体用户");
                	$(".backHome-box >a").css("display","none");// “返回首页”隐藏
                }
	     }
     });
}
//获取session 结束
var layLoaing;
//站点列表方法开始
setTimeout(getUnitIData,500);
function getUnitIData(){
	//alert("历史曲线 danweiID="+danweiID +" usurid = "+ userid+" danweiID = "+danweiID + " danweiName= "+danweiName +"zid = "+zid +"zName = "+zName);
	// userid用户id,unitid单位id,unitid为空时表示调用多个单位的站点信息
    var url="/bigscrenn/getSiteList?userid="+userid+"&unitid="+danweiID;
     $.ajax({
	     cache: true,
	     type: "POST",
	     url:url,
	     data:"",
	     async: false,				   
	     success: function(data){
           // alert(data);
           // js解析json串
           var obj = JSON.parse(data);
           // alert(obj.total);//记录数
           zhandian = obj.rows;// 分类后的站点（用户）
           
           //====
           var zd=obj.rows;
           for(var i = 0;i<zhandian.length;i++){
        	   	$("#zhanDianDl").append('<dd><a class="zhanDian" cid='+obj.rows[i].CID+'>'+obj.rows[i].UNITNAME+'</a></dd>')
           }
           //====
           
           // unitData.getPicData(obj.rows[0].CID);//电气图ID（进入页面时默认第一个站点的电气图）
           // alert("========="+obj.rows[0].CID);
           
    	   var arrr = $(".zhanDian");
    	   // alert("arrr=="+arrr.length);
    	   var firstACID = $(".zhanDian:first()").attr("cid");
    	   localStorage.setItem("energyCID", firstACID);// 没有点击存储本页第一个的站点CID覆盖homecid
    	   var thisCid="";
    	   for (var n=0;n<arrr.length;n++){
    		   arrr[n].index = n;
    		   arrr[n].onclick = function(){
    			   // alert($(this).text()+" 站点id = "+$(this).attr("cid"));
    			   thisCid = $(this).attr("cid");
    			   //setSessionfunc('',thisCid);                   //session存参
    			   setSessionfunc('',thisCid+','+$(this).text(),'',(danweiID+','+danweiName));     // session存站点（第二个参）
    			   window.location.href = "./specificUser.html";// 返回具体页面
    		   }
    		   
    	   }
           
	     }
     });
}
//站点列表方法结束


//实时曲线数据请求开始
openLayLod();//加载前打开动画
function openLayLod(){
	//test22();
	layLoaing = layer.load(1, {   //加载完成走之前显示loading动画
	   shade: [0.1,'#fff']         //0.1透明度的白色背景
	});
	
}
function closeLayLod(){
	layer.close(layLoaing);
}
function tipLayLod(){
	layer.msg('数据加载失败或没有配置');
}

//实时曲线左侧列表开始
var leftidd='';
setTimeout(getData,530);
function getData() {
	
	//alert("历史曲线 ---左侧 danweiID="+danweiID +" usurid = "+ userid+" danweiID = "+danweiID + " danweiName= "+danweiName +"zid = "+zid +"zName = "+zName);
	//得到指定站点实时曲线分析选择列表
	//参数userid用户id,unitid站点id
    //var url="/bigscrenn/getActualList?userid=0100000000000004&unitid=000000000001";
    var url="/bigscrenn/getActualList?userid="+userid+"&unitid="+zid;
     //alert("站点 url= "+url);
    $.ajax({
	     cache: true,
	     type: "POST",
	     url:url,
	     data:"",
	     async: false,			   
	     success: function(data){
           //alert("实时曲线分析选择列表data = "+data);
           //js解析json串
           var obj = JSON.parse(data);
           if(obj.rows.length==0){
        	   setTimeout(closeLayLod,10000);
        	   setTimeout(tipLayLod,11000);
        	   
           }
           for (var i=0;i<obj.rows.length;i++){
               //alert(obj.rows[i].ID);//ID
               //alert(obj.rows[i].NAME);//名称
        	$("#dl").append('<dd><a id='+obj.rows[i].ID+' href="javascript:void(0);">&nbsp;<span>'+obj.rows[i].NAME+'</span></a></dd>');  
        	   
           }
           $("#dl>dd:first() a").addClass("sideActive");
		   var defaultUnitid = $("#dl>dd a.sideActive").attr("id");
		   leftidd = defaultUnitid;
		   test22();
		   //testDetail();
		   $("#thisTitle").text($("#dl>dd a.sideActive").text());// 默认选中第一对应标题
		   //列表 点击事件
		   layui.use('element', function() {
			    var element = layui.element; // 导航的hover效果、二级菜单等功能，需要依赖element模块
			    element.on('nav(demo)', function(elem) {
				    // console.log(elem)
				//alert(elem.text());
				$("#thisTitle").text(elem.text());// 选中选项对应标题
				
				$("#dl>dd a").removeClass("sideActive");
				$(this).addClass("sideActive");
				
				var leftListID = $(this).attr("id");
				leftidd = $(this).attr("id");
				//alert("leftListID==="+leftListID);
				//setTimeout(test22,4344);*/
				
				openLayLod();
				//test22();
				setTimeout(test22,344);
			    })
		   })
		   
	     }
     });
}
//实时曲线左侧列表结束


var nameArr=[],dataArr = [],valueArr=[],XtimeArr = [];
function test22() {
	
	//每次存储前清空
	if(nameArr.length>0){
		nameArr.length=0
	}
	if(dataArr.length>0){
		dataArr.length=0
	}
	if(valueArr.length>0){
		valueArr.length=0
	}
	if(XtimeArr.length>0){
		XtimeArr.length=0
	}
	//alert("nameArr = "+nameArr+" dataArr = "+ " valueArr = "+valueArr);
	//alert("历史曲线11-- danweiID="+danweiID +" usurid = "+ userid+" danweiID = "+danweiID + " danweiName= "+danweiName +"zid = "+zid +"zName = "+zName);
	var leftId = '';
	leftId = leftidd;
	//alert("leftId =    = "+leftId);
	if(leftId == ''){
		leftId = $("#dl>dd a.sideActive").attr("id");
	}
	//var leftId = $("#dl>dd a.sideActive").attr("id");
	//alert('--22--'+leftId);
	var Xarr = [];
	for (var n=0;n<50;n++){
		Xarr.push(n);
	}
	//var nameArr=[],dataArr = [],valueArr=[];
	var dataObj=[];
	//参数userid用户id,unitid站点id,id统计项id
    //var url="/bigscrenn/getActualStatistics?userid=0100000000000004&unitid=000000000001&id=000000000027";
    var url="/bigscrenn/getActualStatistics?userid="+userid+"&unitid="+zid+"&id="+leftId;
    //alert("进来了url为=="+url); 
    $.ajax({
	     cache: true,
	     type: "POST",
	     url:url,
	     data:"",
	     async: false,				   
	     success: function(data){
           //alert(data);
           console.log("实时曲线data = "+data);
          //js解析json串
            var obj = JSON.parse(data);
            var name1 = "";
            var data1 = "";
            for (var i=0;i<obj.rows[0].len;i++){
         	   var obj1 = eval("obj.rows"+i);
         	  console.log("obj1 === "+obj1);
         	   data1 = "";
         	   valueArr[i] = new Array(i);
         	  XtimeArr[i] = new Array(i);
         	   if(obj1!=undefined){
         		  for (var j=0;j<obj1.length;j++){
         		      if (j==0){
         		    	  
         		    	  if (name1==""){
         		    		  name1 = obj1[j].ITEMNAME;
              		      }else{
              		    	  name1 = name1 + "," + obj1[j].ITEMNAME;
              		      }
         		    	 //名称数组
              		     nameArr.push(obj1[j].ITEMNAME);
              		     a = 23;
         		      }
         		     valueArr[i][j] = obj1[j].VALUEA; //实时曲线数据值
         		     XtimeArr[i][j] = obj1[j].CDATE; // 实时曲线子线 X轴数据
         		     //alert("valueArr"+j+" = "+valueArr);
         		     dataObj.push({"name":obj1[j].ITEMNAME,'time':obj1[j].CDATE,'value':obj1[j].VALUEA,'danwei':obj1[j].CONVERSION});
         		      
         		     data1 = data1 +obj1[j].ITEMNAME+","+obj1[j].VALUEA+","+obj1[j].CONVERSION+","+obj1[j].CDATE+";";
                    }
         	   }
         	    
         	    //alert("分组数据："+ data1);
            }
            //alert("XtimeArr = "+XtimeArr.length);
            //alert("分组名字："+XtimeArr[0]);
            
            //console.log("valueArr = "+JSON.stringify(valueArr));
            console.log("dataObj = "+JSON.stringify(dataObj));
            //alert('dataObj = '+dataObj);
            localStorage.setItem("dataObj",JSON.stringify(dataObj));
            var xPublic = [];
            if(xPublic.length>0){
            	xPublic.length=0;
            }
            for(var j=0;j<XtimeArr[0].length;j++){
            	xPublic.push(XtimeArr[0][j].split(' ')[1]);
            }
            //alert("xPublic = "+xPublic);
            console.log(valueArr,"Xarr = ");
            historyFunc(valueArr,Xarr,nameArr);
            localStorage.setItem("dataNum",valueArr[0]);
            //setInterval(historyFunc,5000,valueArr,Xarr,nameArr);
            closeLayLod(); //关闭动画
            if($('.timeLine-echart-child').length>0){
            	$('.timeLine-echart-child').remove();
            }
            for (var i = 0; i < nameArr.length; i++) {
				$('#echarts-total').after('<div class="timeLine-echart timeLine-echart-child"><h3 class="am-text-center" id=child-title'+(i+1)+'>wsw</h3><div  id=childChart'+(i+1)+'>'+i+'</div></div>')
			
            }
            
            
            if(nameArr.length==4){
            	
            	$("#child-title1").text(nameArr[0]);
                $("#child-title2").text(nameArr[1]);
                $("#child-title3").text(nameArr[2]);
                $("#child-title4").text(nameArr[3]);
                childFunc1(valueArr[0],xPublic,nameArr[0]);
                childFunc2(valueArr[1],xPublic,nameArr[0]);
                childFunc3(valueArr[2],xPublic,nameArr[0]);
                //childFunc3(valueArr[3],xPublic,nameArr[0]);
                childFunc4(valueArr[3],xPublic,nameArr[0]);
        	}
            if(nameArr.length==3){
            	
            	$("#child-title1").text(nameArr[0]);
                $("#child-title2").text(nameArr[1]);
                $("#child-title3").text(nameArr[2]);
                childFunc1(valueArr[0],xPublic,nameArr[0]);
                childFunc2(valueArr[1],xPublic,nameArr[0]);
                childFunc3(valueArr[2],xPublic,nameArr[0]);
        	}
            if(nameArr.length==2){
                $("#child-title1").text(nameArr[0]);
                $("#child-title2").text(nameArr[1]);
               
                childFunc1(valueArr[0],xPublic,nameArr[0]);
                childFunc2(valueArr[1],xPublic,nameArr[0]);
        	}
            if(nameArr.length==1){
            	
                $("#child-title1").text(nameArr[0]);
                childFunc1(valueArr[0],xPublic,nameArr[0]);
        	}
	     }
         
     });
	
	
	
}
//实时曲线数据请求开始

//echart表 开始
//function historyFunc(dataA, dataB, dataC,Xarr,legenArr) {
function historyFunc(valueArr,Xarr,legenArr) {
//function historyFunc() {
	//alert("a = "+a);
	var valueArr = valueArr;
	var Xarr=Xarr;
	var legenArr=nameArr;
	
	
	var series = [];
	var colorArr = [];
	var borderColor = [];
	borderColor.push({
		color: '#9152af',
		borderColor: '#9152af',
		borderWidth: 12
	}, {
		color: '#fffe7f',
		borderColor: '#fffe7f',
		borderWidth: 12
	}, {
		color: '#13ab76',
		borderColor: '#13ab76',
		borderWidth: 12
	})
	colorArr.push({
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(222,103,244, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(222,103,244, 0.3)'
		}, {
			offset: 0.7,
			color: 'rgba(222,103,244, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(222,103,244, 0.7)'
		}, {
			offset: 0.3,
			color: 'rgba(222,103,244, 0.8)'
		}, {
			offset: 0.1,
			color: 'rgba(222,103,244, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	}, {
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(79,148,255, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(79,148,255, 0.4)'
		}, {
			offset: 0.7,
			color: 'rgba(79,148,255, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(79,148,255, 0.66)'
		}, {
			offset: 0.3,
			color: 'rgba(79,148,255, 0.86)'
		}, {
			offset: 0.1,
			color: 'rgba(79,148,255, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	}, {
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(15,235,139, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(15,235,139, 0.4)'
		}, {
			offset: 0.7,
			color: 'rgba(15,235,139, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(15,235,139, 0.66)'
		}, {
			offset: 0.3,
			color: 'rgba(15,235,139, 0.86)'
		}, {
			offset: 0.1,
			color: 'rgba(15,235,139, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	});
	//alert("valueArr.length = "+valueArr.length);
	for (var i = 0; i < valueArr.length; i++) {
		//valueArr[i]
		//alert(valueArr[i]);
		series.push({
			name: legenArr[i],
			//name: 'A相电流',
			type: 'line',
			smooth: true,
			symbol: 'circle',
			symbolSize: 5,
			showSymbol: false,
			lineStyle: {
				normal: {
					width: 3
				}
			},
			/*areaStyle: {
				normal: colorArr[i],
				normal2: {
					color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
						offset: 0.99,
						color: 'rgba(222,103,244, 0.2)'
					}, {
						offset: 0.9,
						color: 'rgba(222,103,244, 0.3)'
					}, {
						offset: 0.7,
						color: 'rgba(222,103,244, 0.5)'
					}, {
						offset: 0.5,
						color: 'rgba(222,103,244, 0.7)'
					}, {
						offset: 0.3,
						color: 'rgba(222,103,244, 0.8)'
					}, {
						offset: 0.1,
						color: 'rgba(222,103,244, 0.99)'
					}], false),
					shadowColor: 'rgba(0, 0, 0, 0.9)',
					shadowBlur: 10
				}
			},*/
			itemStyle: {
				normal: borderColor[i],
				normal1: {
					color: '#f4a240',
					borderColor: 'rgba(137,189,2,0.27)',
					borderWidth: 12
				}
			},
			//data: [, , , 34, 110, 220, 150, 75, 30, , , ]
			data: valueArr[i]
		})
		
	}
	
	
	//alert(" legenArr = "+legenArr);
	var myChart3 = echarts.init(document.getElementById('echarts-total'));
	option3 = {
		
		backgroundColor: "rgb(0,0,0,.2)",
		tooltip: {
			trigger: 'axis',
			axisPointer: {
				lineStyle: {
					color: '#57617B'
				}
			}
		},
		legend: {

			icon: 'rect',
			data:legenArr,
			//data: ['A相电流', 'B相电流', 'C相电流'],
			align: 'right',
			right: '2%',
			top: '5%',
			textStyle: {
				color: "#fff"
			},
			itemWidth: 30,
			itemHeight: 10,
			itemGap: 15
		},
		grid: {
			left: '2%',
			right: '3%',
			top: '20%',
			bottom: '5%',
			containLabel: true
		},
		xAxis: [{
			type: 'category',
			boundaryGap: false,
			axisLine: {
				lineStyle: {
					color: '#fff'
				}
			},
			data:Xarr,
			//data: ['13:00', '13:05', '13:10', '13:15', '13:20', '13:25', '13:30', '13:35', '13:40', '13:45', '13:50', '13:55']
		}, {
			axisLine: {
				show: false, //上横轴
				lineStyle: {
					color: 'red',
				}
			},

		}],
		yAxis: [{
			axisLabel: {
				show: true,
				formatter: '{value}'
			},
			splitLine: {
				lineStyle: {
					color: 'rgba(255,255,255,.1)'
				}
			},
			axisLine: {
				lineStyle: {
					color: '#fff'
				}
			},
		}],
		series:[],
		series1: [{
			name:legenArr[0],
			//name: 'A相电流',
			type: 'line',
			smooth: true,
			symbol: 'circle',
			symbolSize: 5,
			showSymbol: false,
			lineStyle: {
				normal: {
					width: 2
				}
			},
			areaStyle: {
				normal: colorArr[i],
				normal1: {
					color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
						offset: 0.99,
						color: 'rgba(222,103,244, 0.2)'
					}, {
						offset: 0.9,
						color: 'rgba(222,103,244, 0.3)'
					}, {
						offset: 0.7,
						color: 'rgba(222,103,244, 0.5)'
					}, {
						offset: 0.5,
						color: 'rgba(222,103,244, 0.7)'
					}, {
						offset: 0.3,
						color: 'rgba(222,103,244, 0.8)'
					}, {
						offset: 0.1,
						color: 'rgba(222,103,244, 0.99)'
					}], false),
					shadowColor: 'rgba(0, 0, 0, 0.9)',
					shadowBlur: 10
				}
			},
			itemStyle: {
				normal: borderColor[i],
				normal1: {
					color: '#f4a240',
					borderColor: 'rgba(137,189,2,0.27)',
					borderWidth: 12
				}
			},
			data: [, , , 34, 110, 220, 150, 75, 30, , , ]
			//data: dataA
		}, {
			name:legenArr[1],
			//name: 'B相电流',
			type: 'line',
			smooth: true,
			symbol: 'circle',
			symbolSize: 5,
			showSymbol: false,
			lineStyle: {
				normal: {
					width: 3
				}
			},
			areaStyle: {
				normal: {
					color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
						offset: 0.99,
						color: 'rgba(79,148,255, 0.2)'
					}, {
						offset: 0.9,
						color: 'rgba(79,148,255, 0.4)'
					}, {
						offset: 0.7,
						color: 'rgba(79,148,255, 0.5)'
					}, {
						offset: 0.5,
						color: 'rgba(79,148,255, 0.66)'
					}, {
						offset: 0.3,
						color: 'rgba(79,148,255, 0.86)'
					}, {
						offset: 0.1,
						color: 'rgba(79,148,255, 0.99)'
					}], false),
					shadowColor: 'rgba(0, 0, 0, 0.9)',
					shadowBlur: 10
				}
			},
			itemStyle: {
				normal: {
					color: '#00ff00',
					borderColor: 'rgba(0,136,212,0.5)',
					borderWidth: 12
				}
			},
					data: [10, 180, 75, 145, 222, 165, 132, 200, 182, 61, 164, 50]
//			data: dataB
		}, {
			name:legenArr[2],
			//name: 'C相电流',
			type: 'line',
			smooth: true,
			symbol: 'circle',
			symbolSize: 5,
			showSymbol: false,
			lineStyle: {
				normal: {
					width: 3
				}
			},
			areaStyle: {
				normal: {
					color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
						offset: 0.99,
						color: 'rgba(15,235,139, 0.2)'
					}, {
						offset: 0.9,
						color: 'rgba(15,235,139, 0.4)'
					}, {
						offset: 0.7,
						color: 'rgba(15,235,139, 0.5)'
					}, {
						offset: 0.5,
						color: 'rgba(15,235,139, 0.66)'
					}, {
						offset: 0.3,
						color: 'rgba(15,235,139, 0.86)'
					}, {
						offset: 0.1,
						color: 'rgba(15,235,139, 0.99)'
					}], false),
					shadowColor: 'rgba(0, 0, 0, 0.9)',
					shadowBlur: 10
				}
			},
			itemStyle: {
				normal: {
					color: '#FFFF00',
					borderColor: 'rgba(0,136,212,0.5)',
					borderWidth: 12
				}
			},
			data: [120, 110, 125, 145, 122, 165, 122, 220, 182, 191, 134, 150]
			//data: dataC
		}]
	};
	
	option3.series = series;
    myChart3.setOption(option3,true);
	
}

//echart表 结束


//echart子表1 开始
function childFunc1(valueArr,Xarr,legenArr) {
	//alert("a = "+a);
	var valueArr = valueArr;
	var Xarr=Xarr;
	var legenArr=nameArr;
	
	var series = [];
	var colorArr = [];
	var borderColor = [];
	borderColor.push({
		color: '#9152af',
		borderColor: '#9152af',
		borderWidth: 12
	}, {
		color: '#385fa1',
		borderColor: '#385fa1',
		borderWidth: 12
	}, {
		color: '#13ab76',
		borderColor: '#13ab76',
		borderWidth: 12
	})
	colorArr.push({
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(222,103,244, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(222,103,244, 0.3)'
		}, {
			offset: 0.7,
			color: 'rgba(222,103,244, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(222,103,244, 0.7)'
		}, {
			offset: 0.3,
			color: 'rgba(222,103,244, 0.8)'
		}, {
			offset: 0.1,
			color: 'rgba(222,103,244, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	}, {
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(79,148,255, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(79,148,255, 0.4)'
		}, {
			offset: 0.7,
			color: 'rgba(79,148,255, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(79,148,255, 0.66)'
		}, {
			offset: 0.3,
			color: 'rgba(79,148,255, 0.86)'
		}, {
			offset: 0.1,
			color: 'rgba(79,148,255, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	}, {
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(15,235,139, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(15,235,139, 0.4)'
		}, {
			offset: 0.7,
			color: 'rgba(15,235,139, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(15,235,139, 0.66)'
		}, {
			offset: 0.3,
			color: 'rgba(15,235,139, 0.86)'
		}, {
			offset: 0.1,
			color: 'rgba(15,235,139, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	});
	//alert("valueArr.length = "+valueArr.length);
	
	//alert(" legenArr = "+legenArr);
	var childChart1 = echarts.init(document.getElementById('childChart1'));
	var option1 = {
		
		backgroundColor: "rgb(0,0,0,.2)",
		tooltip: {
			trigger: 'axis',
			show:true,
			axisPointer: {
				lineStyle: {
					color: '#57617B'
				}
			}
		},
		legend: {
			orient: 'horizontal',// 'vertical'
			icon: 'rect',
			data:legenArr[0],
			//data: ['A相电流', 'B相电流', 'C相电流'],
			align: 'right',
			right: '2%',
			top: '5%',
			textStyle: {
				color: "#fff"
			},
			itemWidth: 30,
			itemHeight: 10,
			itemGap: 15
		},
		grid: {
			left: '2%',
			right: '3%',
			top: '20%',
			bottom: '5%',
			containLabel: true
		},
		xAxis: [{
			type: 'category',
			boundaryGap: false,
			axisLine: {
				lineStyle: {
					color: '#fff'
				}
			},
			axisLabel: {
				interval: 1, 
				//formatter: '{value}<br/>点',
				formatter: '{value}',
				 rotate:40,
				show: true,
				splitNumber: 3,
				textStyle: {
					fontFamily: "微软雅黑",
					color: "rgba(255,255,255,.6)",
					fontSize: '80%',
				},
			},
			data:Xarr,
			//data: ['13:00', '13:05', '13:10', '13:15', '13:20', '13:25', '13:30', '13:35', '13:40', '13:45', '13:50', '13:55']
		}, {
			axisLine: {
				show: false, //上横轴
				lineStyle: {
					color: 'red',
				}
			},

		}],
		yAxis: [{
			axisLabel: {
				show: true,
				formatter: '{value}'
			},
			splitLine: {
				lineStyle: {
					color: 'rgba(255,255,255,.1)'
				}
			},
			axisLine: {
				lineStyle: {
					color: '#fff'
				}
			},
		}],
		series:[],
		
	};
	
	option1.series = [{
			name: legenArr[0],
			//name: 'A相电流',
			type: 'line',
			smooth: true,
			symbol: 'circle',
			symbolSize: 5,
			showSymbol: false,
			lineStyle: {
				normal: {
					width: 3
				}
			},
			
			itemStyle: {
				normal: borderColor[0],
				normal1: {
					color: '#f4a240',
					borderColor: 'rgba(137,189,2,0.27)',
					borderWidth: 12
				}
			},
			//data: [, , , 34, 110, 220, 150, 75, 30, , , ]
			data: valueArr
		}];
	childChart1.setOption(option1,true);
	
}

//echart子表2 开始
function childFunc2(valueArr,Xarr,legenArr) {
	//alert("Xarr = "+Xarr);
	var valueArr = valueArr;
	var Xarr=Xarr;
	var legenArr=nameArr;
	
	var series = [];
	var colorArr = [];
	var borderColor = [];
	borderColor.push({
		color: '#9152af',
		borderColor: '#9152af',
		borderWidth: 12
	}, {
		color: '#fffe7f',
		borderColor: '#fffe7f',
		borderWidth: 12
	}, {
		color: '#13ab76',
		borderColor: '#13ab76',
		borderWidth: 12
	})
	colorArr.push({
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(222,103,244, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(222,103,244, 0.3)'
		}, {
			offset: 0.7,
			color: 'rgba(222,103,244, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(222,103,244, 0.7)'
		}, {
			offset: 0.3,
			color: 'rgba(222,103,244, 0.8)'
		}, {
			offset: 0.1,
			color: 'rgba(222,103,244, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	}, {
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(79,148,255, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(79,148,255, 0.4)'
		}, {
			offset: 0.7,
			color: 'rgba(79,148,255, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(79,148,255, 0.66)'
		}, {
			offset: 0.3,
			color: 'rgba(79,148,255, 0.86)'
		}, {
			offset: 0.1,
			color: 'rgba(79,148,255, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	}, {
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(15,235,139, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(15,235,139, 0.4)'
		}, {
			offset: 0.7,
			color: 'rgba(15,235,139, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(15,235,139, 0.66)'
		}, {
			offset: 0.3,
			color: 'rgba(15,235,139, 0.86)'
		}, {
			offset: 0.1,
			color: 'rgba(15,235,139, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	});
	//alert("valueArr.length = "+valueArr.length);
	
	//alert(" legenArr = "+legenArr);
	var childChart2 = echarts.init(document.getElementById('childChart2'));
	var option2 = {
		
		backgroundColor: "rgb(0,0,0,.2)",
		tooltip: {
			trigger: 'axis',
			show:true,
			axisPointer: {
				lineStyle: {
					color: '#57617B'
				}
			}
		},
		legend: {
			orient: 'horizontal',// 'vertical'
			icon: 'rect',
			data:legenArr[1],
			//data: ['A相电流', 'B相电流', 'C相电流'],
			align: 'right',
			right: '2%',
			top: '5%',
			textStyle: {
				color: "#fff"
			},
			itemWidth: 30,
			itemHeight: 10,
			itemGap: 15
		},
		grid: {
			left: '2%',
			right: '3%',
			top: '20%',
			bottom: '5%',
			containLabel: true
		},
		xAxis: [{
			type: 'category',
			boundaryGap: false,
			axisLine: {
				lineStyle: {
					color: '#fff'
				}
			},
			axisLabel: {
				interval: 1, 
				//formatter: '{value}<br/>点',
				formatter: '{value}',
				 rotate:40,
				show: true,
				splitNumber: 3,
				textStyle: {
					fontFamily: "微软雅黑",
					color: "rgba(255,255,255,.6)",
					fontSize: '80%',
				},
			},
			data:Xarr,
			//data: ['13:00', '13:05', '13:10', '13:15', '13:20', '13:25', '13:30', '13:35', '13:40', '13:45', '13:50', '13:55']
		}, {
			axisLine: {
				show: false, //上横轴
				lineStyle: {
					color: 'red',
				}
			},

		}],
		yAxis: [{
			axisLabel: {
				show: true,
				formatter: '{value}'
			},
			splitLine: {
				lineStyle: {
					color: 'rgba(255,255,255,.1)'
				}
			},
			axisLine: {
				lineStyle: {
					color: '#fff'
				}
			},
		}],
		series:[],
	};
	
	option2.series = [{
		name: legenArr[1],
		//name: 'A相电流',
		type: 'line',
		smooth: true,
		symbol: 'circle',
		symbolSize: 5,
		showSymbol: false,
		lineStyle: {
			normal: {
				width: 3
			}
		},
		itemStyle: {
			normal: borderColor[1],
			normal1: {
				color: '#f4a240',
				borderColor: 'rgba(137,189,2,0.27)',
				borderWidth: 12
			}
		},
		//data: [, , , 34, 110, 220, 150, 75, 30, , , ]
		data: valueArr}];
	childChart2.setOption(option2,true);
	
}

//echart子表3 开始
function childFunc3(valueArr,Xarr,legenArr) {
	//alert("a = "+a);
	var valueArr = valueArr;
	var Xarr=Xarr;
	var legenArr=nameArr;
	
	var series = [];
	var colorArr = [];
	var borderColor = [];
	borderColor.push({
		color: '#9152af',
		borderColor: '#9152af',
		borderWidth: 12
	}, {
		color: '#385fa1',
		borderColor: '#385fa1',
		borderWidth: 12
	}, {
		color: '#13ab76',
		borderColor: '#13ab76',
		borderWidth: 12
	})
	colorArr.push({
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(222,103,244, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(222,103,244, 0.3)'
		}, {
			offset: 0.7,
			color: 'rgba(222,103,244, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(222,103,244, 0.7)'
		}, {
			offset: 0.3,
			color: 'rgba(222,103,244, 0.8)'
		}, {
			offset: 0.1,
			color: 'rgba(222,103,244, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	}, {
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(79,148,255, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(79,148,255, 0.4)'
		}, {
			offset: 0.7,
			color: 'rgba(79,148,255, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(79,148,255, 0.66)'
		}, {
			offset: 0.3,
			color: 'rgba(79,148,255, 0.86)'
		}, {
			offset: 0.1,
			color: 'rgba(79,148,255, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	}, {
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(15,235,139, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(15,235,139, 0.4)'
		}, {
			offset: 0.7,
			color: 'rgba(15,235,139, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(15,235,139, 0.66)'
		}, {
			offset: 0.3,
			color: 'rgba(15,235,139, 0.86)'
		}, {
			offset: 0.1,
			color: 'rgba(15,235,139, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	});
	//alert("valueArr.length = "+valueArr.length);
	
	//alert(" legenArr = "+legenArr);
	var childChart3 = echarts.init(document.getElementById('childChart3'));
	var option4 = {
		
		backgroundColor: "rgb(0,0,0,.2)",
		tooltip: {
			trigger: 'axis',
			show:true,
			axisPointer: {
				lineStyle: {
					color: '#57617B'
				}
			}
		},
		legend: {
			orient: 'horizontal',// 'vertical'
			icon: 'rect',
			data:legenArr[2],
			//data: ['A相电流', 'B相电流', 'C相电流'],
			align: 'right',
			right: '2%',
			top: '5%',
			textStyle: {
				color: "#fff"
			},
			itemWidth: 30,
			itemHeight: 10,
			itemGap: 15
		},
		grid: {
			left: '2%',
			right: '3%',
			top: '20%',
			bottom: '5%',
			containLabel: true
		},
		xAxis: [{
			type: 'category',
			boundaryGap: false,
			axisLine: {
				lineStyle: {
					color: '#fff'
				}
			},
			axisLabel: {
				interval: 1, 
				//formatter: '{value}<br/>点',
				formatter: '{value}',
				 rotate:40,
				show: true,
				splitNumber: 3,
				textStyle: {
					fontFamily: "微软雅黑",
					color: "rgba(255,255,255,.6)",
					fontSize: '80%',
				},
			},
			data:Xarr,
			//data: ['13:00', '13:05', '13:10', '13:15', '13:20', '13:25', '13:30', '13:35', '13:40', '13:45', '13:50', '13:55']
		}, {
			axisLine: {
				show: false, //上横轴
				lineStyle: {
					color: 'red',
				}
			},

		}],
		yAxis: [{
			axisLabel: {
				show: true,
				formatter: '{value}'
			},
			splitLine: {
				lineStyle: {
					color: 'rgba(255,255,255,.1)'
				}
			},
			axisLine: {
				lineStyle: {
					color: '#fff'
				}
			},
		}],
		series:[],
	};
	
	option4.series = [{
		name: legenArr[2],
		//name: 'A相电流',
		type: 'line',
		smooth: true,
		symbol: 'circle',
		symbolSize: 5,
		showSymbol: false,
		lineStyle: {
			normal: {
				width: 3
			}
		},
		itemStyle: {
			normal: borderColor[2],
			normal1: {
				color: '#f4a240',
				borderColor: 'rgba(137,189,2,0.27)',
				borderWidth: 12
			}
		},
		//data: [, , , 34, 110, 220, 150, 75, 30, , , ]
		data: valueArr
	}];
	childChart3.setOption(option4,true);
	
}

//echart子表3 开始
function childFunc4(valueArr,Xarr,legenArr) {
	//alert("a = "+a);
	var valueArr = valueArr;
	var Xarr=Xarr;
	var legenArr=nameArr;
	
	var series = [];
	var colorArr = [];
	var borderColor = [];
	borderColor.push({
		color: '#9152af',
		borderColor: '#9152af',
		borderWidth: 12
	}, {
		color: '#385fa1',
		borderColor: '#385fa1',
		borderWidth: 12
	}, {
		color: '#13ab76',
		borderColor: '#13ab76',
		borderWidth: 12
	})
	colorArr.push({
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(222,103,244, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(222,103,244, 0.3)'
		}, {
			offset: 0.7,
			color: 'rgba(222,103,244, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(222,103,244, 0.7)'
		}, {
			offset: 0.3,
			color: 'rgba(222,103,244, 0.8)'
		}, {
			offset: 0.1,
			color: 'rgba(222,103,244, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	}, {
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(79,148,255, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(79,148,255, 0.4)'
		}, {
			offset: 0.7,
			color: 'rgba(79,148,255, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(79,148,255, 0.66)'
		}, {
			offset: 0.3,
			color: 'rgba(79,148,255, 0.86)'
		}, {
			offset: 0.1,
			color: 'rgba(79,148,255, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	}, {
		color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0.99,
			color: 'rgba(15,235,139, 0.2)'
		}, {
			offset: 0.9,
			color: 'rgba(15,235,139, 0.4)'
		}, {
			offset: 0.7,
			color: 'rgba(15,235,139, 0.5)'
		}, {
			offset: 0.5,
			color: 'rgba(15,235,139, 0.66)'
		}, {
			offset: 0.3,
			color: 'rgba(15,235,139, 0.86)'
		}, {
			offset: 0.1,
			color: 'rgba(15,235,139, 0.99)'
		}], false),
		shadowColor: 'rgba(0, 0, 0, 0.9)',
		shadowBlur: 10
	});
	//alert("valueArr.length = "+valueArr.length);
	
	//alert(" legenArr = "+legenArr);
	var childChart4 = echarts.init(document.getElementById('childChart4'));
	var option5 = {
		
		backgroundColor: "rgb(0,0,0,.2)",
		tooltip: {
			trigger: 'axis',
			show:true,
			axisPointer: {
				lineStyle: {
					color: '#57617B'
				}
			}
		},
		legend: {
			orient: 'horizontal',// 'vertical'
			icon: 'rect',
			data:legenArr[2],
			//data: ['A相电流', 'B相电流', 'C相电流'],
			align: 'right',
			right: '2%',
			top: '5%',
			textStyle: {
				color: "#fff"
			},
			itemWidth: 30,
			itemHeight: 10,
			itemGap: 15
		},
		grid: {
			left: '2%',
			right: '3%',
			top: '20%',
			bottom: '5%',
			containLabel: true
		},
		xAxis: [{
			type: 'category',
			boundaryGap: false,
			axisLine: {
				lineStyle: {
					color: '#fff'
				}
			},
			axisLabel: {
				interval: 1, 
				//formatter: '{value}<br/>点',
				formatter: '{value}',
				 rotate:40,
				show: true,
				splitNumber: 3,
				textStyle: {
					fontFamily: "微软雅黑",
					color: "rgba(255,255,255,.6)",
					fontSize: '80%',
				},
			},
			data:Xarr,
			//data: ['13:00', '13:05', '13:10', '13:15', '13:20', '13:25', '13:30', '13:35', '13:40', '13:45', '13:50', '13:55']
		}, {
			axisLine: {
				show: false, //上横轴
				lineStyle: {
					color: 'red',
				}
			},

		}],
		yAxis: [{
			axisLabel: {
				show: true,
				formatter: '{value}'
			},
			splitLine: {
				lineStyle: {
					color: 'rgba(255,255,255,.1)'
				}
			},
			axisLine: {
				lineStyle: {
					color: '#fff'
				}
			},
		}],
		series:[],
	};
	
	option5.series = [{
		name: legenArr[2],
		//name: 'A相电流',
		type: 'line',
		smooth: true,
		symbol: 'circle',
		symbolSize: 5,
		showSymbol: false,
		lineStyle: {
			normal: {
				width: 3
			}
		},
		itemStyle: {
			normal: borderColor[3],
			normal1: {
				color: '#f4a240',
				borderColor: 'rgba(137,189,2,0.27)',
				borderWidth: 12
			}
		},
		//data: [, , , 34, 110, 220, 150, 75, 30, , , ]
		data: valueArr
	}];
	childChart4.setOption(option5,true);
	
}


//echart表 结束

//点击详情 开始
function openLayerFunc(id){
	openLayLod();
	//alert("leftidd = "+leftidd);
	setTimeout(testDetail,543);
	
	// 告警信息 弹框开始
	var area = [];
	var title = '';
	
	if(id == "ssQuXian"){//当点击实时告警推送的详情时的操作
		setSessionfunc('','',id,'');
		area = ['1020px','500px'];
		resize:false;//是否允许拉伸
		//ifFunc("实时曲线",area,id);
		setTimeout(ifFunc,700,"实时曲线",area,id);
	}
	
	function ifFunc(title,area,ID){
		layer.open({
			type: 2,
			title: false,
			//title:'实时告警详情',
			title:title,
			center:"center",
			closeBtn: 1,
			//area: ['600px', '800px'],
			area: area,
			shadeClose: true,
			skin:"myskin",
			scrollbar:false,
			content: './tanKuang.html'
		});
		
		//layer 弹框标题、关闭x样式
		$('.myskin').css({
			'background':'#07256b'
		})
		$(".myskin a.layui-layer-ico").text('×').css({
			'color':'#fff',
			'fontSize':'2rem',
			'margin-top': '-15px',
			'background':'none'
		});
		$(".layui-layer-title").css({'color':'#fff',});
		
		//关闭动画
		closeLayLod();
	}
	
}

function testDetail() {
	//每次存储前清空
	if(nameArr.length>0){
		nameArr.length=0
	}
	if(dataArr.length>0){
		dataArr.length=0
	}
	if(valueArr.length>0){
		valueArr.length=0
	}
	//alert("nameArr = "+nameArr+" dataArr = "+ " valueArr = "+valueArr);
	//alert("历史曲线11-- danweiID="+danweiID +" usurid = "+ userid+" danweiID = "+danweiID + " danweiName= "+danweiName +"zid = "+zid +"zName = "+zName);
	var leftId = '';
	leftId = leftidd;
	//alert("leftId =    = "+leftId);
	if(leftId == ''){
		leftId = $("#dl>dd a.sideActive").attr("id");
	}
	//var leftId = $("#dl>dd a.sideActive").attr("id");
	//alert('--22--'+leftId);
	var Xarr = [];
	for (var n=0;n<50;n++){
		Xarr.push(n);
	}
	//var nameArr=[],dataArr = [],valueArr=[];
	var dataObj=[];
	//参数userid用户id,unitid站点id,id统计项id,type=2,为1时调用50条记录显示图表，为2时调用1000条内记录显示详细列表
    //var url="/bigscrenn/getActualStatistics?userid=0100000000000004&unitid=000000000001&id=000000000027&type=2";
    var url="/bigscrenn/getActualStatistics?userid="+userid+"&unitid="+zid+"&id="+leftId+"&type=2";
    
    //alert("进来了detail url为=="+url); 
    $.ajax({
	     cache: true,
	     type: "POST",
	     url:url,
	     data:"",
	     async: false,				   
	     success: function(data){
           //alert(data);
           console.log("实时曲线data = "+data);
          //js解析json串
            var obj = JSON.parse(data);
            var name1 = "";
            var data1 = "";
            for (var i=0;i<obj.rows[0].len;i++){
         	   var obj1 = eval("obj.rows"+i);
         	   data1 = "";
         	   valueArr[i] = new Array(i);
         	   for (var j=0;j<obj1.length;j++){
     		      if (j==0){
     		    	  
     		    	  if (name1==""){
     		    		  name1 = obj1[j].ITEMNAME;
          		      }else{
          		    	  name1 = name1 + "," + obj1[j].ITEMNAME;
          		      }
     		    	 //名称数组
          		     nameArr.push(obj1[j].ITEMNAME);
          		     
     		      }
     		     valueArr[i][j] = obj1[j].VALUEA; //实时曲线数据值
     		     //alert("valueArr"+j+" = "+valueArr);
     		     dataObj.push({"name":obj1[j].ITEMNAME,'time':obj1[j].CDATE,'value':obj1[j].VALUEA,'danwei':obj1[j].CONVERSION});
     		      
     		     data1 = data1 +obj1[j].ITEMNAME+","+obj1[j].VALUEA+","+obj1[j].CONVERSION+","+obj1[j].CDATE+";";
                }
         	    
         	    //alert("分组数据："+ data1);
            }
            //alert("分组名字："+name1);
            
            //console.log("valueArr = "+JSON.stringify(valueArr));
            console.log("dataObj = "+JSON.stringify(dataObj));
            //alert('dataObj = '+dataObj);
            //localStorage.setItem("dataObj",JSON.stringify(dataObj));
            closeLayLod();
	     }
     });
	
	
	
}
//点击详情 结束

//在线值班 开始
function onlineFunc(){
	//alert("online zhandianid = "+zhandianid);
	// unitid 是站点ID
	// var url="/bigtongji/getRotaList?unitid=000000000001";
	var url="/bigtongji/getRotaList?unitid="+zhandianid;
	 $.ajax({
	     cache: true,
	     type: "POST",
	     url:url,
	     data:"",
	     async: false,				   
	     success: function(data){
        // alert(data);
        console.log(data);
        var dataObj=eval("("+data+")");// 转换为json对象
        // alert(dataObj);
        // alert(dataObj);
        if(dataObj.rows.length>0){
    		 $("#onlineNotice").html('');
    		 for (var i = 0; i < dataObj.rows.length; i++) {
         		var cid= dataObj.rows[i].cid;
         		var name= dataObj.rows[i].rname;
         		var phone= dataObj.rows[i].phoneCode;
         		//alert(cid);
         		//alert("cid="+cid+"name="+name+"phone="+phone);
        		 $("#onlineNotice").append('<li><span>👨‍⚖️&nbsp;&nbsp;<span id="onlineName1">'+name+'</span>&nbsp;电话：</span><span>'+phone+'</span></li>');
         	  }
    	  }
    	 if(dataObj.rows.length==0){
    		$("#onlineNotice").html(''); 
    	 }
	     }
	 });

}
//值班人员结束

//返回上一级跳转逻辑处理
function bachFunc(){
	var urlsStr = localStorage.getItem("urls");
	var ss = JSON.parse(urlsStr);
	if(ss.sanji != undefined &&  ss.sanji !=''){
    	//alert("ss.sanji = "+ss.sanji);
	    window.location.href = './specificHome.html';
    	return;
    }
    if(ss.erji != undefined && ss.erji !=''){
    	//alert("ss.erji = "+ss.erji);
	    window.location.href = './intlgMonitor.html';
	    return;
    }if(ss.yiji != undefined &&  ss.yiji !=''){
    	//alert("ss.yiji = "+ss.yiji);
	    window.location.href = './pro_Home.html';
	    return;
    }else{
	   //alert(222)
    }
}

